amrio.fn.extend({
	drag: function(drag,drop){
		$.each(this, function(){
			var ren = this,
			isInit = false,
			parent,
			position = {};
			ren.style.cursor = "move";
			
			parent = ren.parentNode;
			ren.style.position != "absolute" && (ren.style.position = "absolute");
			ren.onmousedown = function(e0){					
				document.onmousemove = function(e1){
					position.left = e1.clientX - e0.layerX;
					position.top = e1.clientY - e0.layerY;
					ren.style.left = position.left + "px";
					ren.style.top = position.top + "px";
					$.isFunc(drag) && drag(position);
				};
			};
			ren.onmouseup = function(){
				$.isFunc(drop) && drop(position);
			};
			document.onmouseup = function(){
				document.onmousemove = function(){ };	
			};
			
			// each end
		});
		
		//drag end
	}	
});